1. Field of the Invention
The present invention relates to a microcomputer and its use, and more particularly, to an instruction decoding unit in a microcomputer having an instruction word capable of being selected by a user and a method of encoding/decoding the instruction word.
2. Discussion of the Related Art
Generally, a microcomputer includes a central processing unit (CPU), a memory, peripheral units, and an input/output unit on a chip. Recently, microcomputers have been widely used in household electric appliances, office automation machines, industrial electric machines, and the like.
The microcomputer allows the CPU to process instructions and data from a memory storing application software selected by a user, and controls the peripheral units and the input/output unit.
An instruction decoding unit in a conventional microcomputer will be described with reference to the accompanying drawings.
FIG. 1 is a block diagram illustrating an instruction decoding unit in a conventional microcomputer.
As shown in FIG. 1, the instruction decoding unit in the conventional microcomputer includes an instruction register 11 for storing instructions fetched through a data bus from a memory that stores application software selected by a user, an instruction decoder 12 for decoding the instructions stored in the instruction register 11 and for designating micro (μ)-instructions to be executed, and a micro read only memory (μ-ROM) 13 for outputting a series of the micro-instructions (combination of control signals) designated by the instruction decoder 12.
The operation of the instruction decoding unit in the conventional microcomputer will be described below.
The instruction register 11 stores the instructions fetched from the memory, which stores application software selected by the user, through the data bus. The instruction register 11 outputs the instructions to the instruction decoder 12, if necessary.
The instruction decoder 12 receives the instructions from the instruction register 11 and a signal NXA from the micro-ROM 13 for designating the next micro-instructions, and designates the micro-instructions of the micro-ROM 13 that are to be executed. That is, a command address from micro-ROM 13 contains the signal NXA, which is used to designate a next instruction code.
The micro-ROM 13 receives the micro-instructions designated from the instruction decoder 12 and outputs the signal NXA for designating the micro-instructions to be output in the next cycle, and outputs the micro-instructions.
The micro-instructions of the micro-ROM 13 are input to an arithmetic and logic unit (ALU) and various registers, none of which are shown, to perform designated functions.
However, the instruction decoding unit in the conventional microcomputer has several problems.
First, since the conventional microcomputer has fixed instruction sets, it may be impossible for the user to designate a desired instruction word set.
Second, when a program code of the user is open, it is easy to decode the program code using a fixed instruction map, thereby likely causing security problems for the program.
Finally, when the user produces application software, it is sometimes impossible to designate an instruction word that is frequently used by the user.